﻿
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=yes" />
    <meta name="format-detection" content="email=no" />
    <title>
        勘查信息手机版
    </title>
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <link rel="stylesheet" type="text/css" href="css/buttons.css" />
    <meta content="勘查信息手机版" name="keywords" />
    <!-- 权限设置 -->
    <script type="text/javascript" src="writeJS/WebApi.js"></script>
    <style>
        #listTable tr {
            border: #eeeaea solid 1px;
            padding-top: 5px;
        }

            #listTable tr td {
                padding-top: 5px;
                padding-bottom: 5px;
                padding-left: 5px;
            }

        .listTableShow {
            border: #eeeaea solid 1px;
            padding-top: 5px;
            padding-bottom: 5px;
            padding-left: 5px;
        }

            .listTableShow dl {
                border-bottom: #eeeaea solid 1px;
            }
    </style>
</head>
<body>
    <div class="tzrl_box">
        <div class="mq_top">
            <div class="btn_back_l">
                <a class="btn_back" onclick="history.go(-1)">
                    <span></span>
                    <nav>返回</nav>
                </a>
            </div>
            <div class="mq_title">
                询价记录
            </div>
            <div class="btn_ch_r">
            </div>
        </div>
        <div class="job_content">
            <div class="d_description">
                <h3 class="d_title">
                    基本信息
                </h3>
                <div class="d_pos_box">
                    <form id="addform">
                        <dl>
                            <dt>录入询价：</dt>
                            <dd>
                                <table style="width:100%" id="listTable">
                                    <tr>
                                        <td style="width:60%">
                                            <input name="T_Price" id="T_Price" class="input_boxfield" value="" placeholder="请输入询价建议价格" type="text" maxlength="5" />
                                        </td>
                                        <td style="width:35%"></td>
                                    </tr>
                                    <tr>
                                        <td style="width:60%">
                                            <input name="T_Iname" id="T_Iname" class="input_boxfield" value="" placeholder="请输入询价内容" type="text" maxlength="50" />
                                        </td>
                                        <td style="width:35%;">
                                            <button class="button green" id="jbSub" type="button">保存</button>
                                        </td>
                                    </tr>
                                </table>
                            </dd>
                        </dl>
                        <dl>
                            <dt>询价列表：</dt>
                            <dd class="listTableShow">
                                <!--<dl>
                                    <dd>
                                        建议价格：100万
                                    </dd>
                                    <dd>
                                        内容：回龙观龙腾小区回龙观龙腾小区回龙观龙腾小区回龙观龙腾小区
                                    </dd>
                                </dl>
                                <dl>
                                    <dd>
                                        建议价格：100万
                                    </dd>
                                    <dd>
                                        内容：回龙观龙腾小区回龙观龙腾小区回龙观龙腾小区回龙观龙腾小区
                                    </dd>
                                </dl>-->
                            </dd>
                        </dl>
                    </form>
                </div>
            </div>
        </div>
        <div class="footer">
            <div class="footer_top">
                <ul class="user_info">
                    <a href="Index.html">主页</a>
                </ul>
                <ul class="back_top">
                    <a href="javascript:scroll(0,0)">TOP</a>
                </ul>
            </div>
            <ul class="copyright">
                <li>
                    <a href="javascript:;">电脑版</a><span>|</span><a href="javascript:;">普通版</a><span>|</span><a href="javascript:;">用户反馈</a><span>|</span><a href="javascript:;">联系我们</a>
                </li>
                <li>&copy;Copyright 北京中资房产 by 房产估价系统1.0 </li>
            </ul>
        </div>
    </div>
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/layer/layer.js"></script>
    <script type="text/javascript" src="writeJS/Common.js"></script>
    <script type="text/javascript">
        var uri = document.location.search;//接收页面传值
        var i = uri.lastIndexOf("?") + 1;//获取问号前面的值
        var P_ReportNumber = uri.substr(i);//截取问号前面的值
        $(function () {
            Show();
            //保存
            $("#jbSub").click(function () {
                var parms = {
                    T_ReportNumber: P_ReportNumber,
                    T_Price: $("#T_Price").val(),
                    T_Iname: $("#T_Iname").val()
                };
                $.ajax({
                    type: "post",
                    url: ApiUrl + "api/InquiryRecord/InsertInquiryRecord",
                    data: parms,
                    success: function (data, status) {
                        if (status == "success") {
                            if (data == true) {
                                layer.msg('保存成功!', { icon: 1, time: 1000 });
                                Show();

                                $("#T_Price").val("");
                                $("#T_Iname").val("");
                                $("#T_Price").focus();
                            }
                            else {
                                layer.msg('保存失败!', { icon: 2, time: 1000 });
                            }
                        }
                    },
                    error: function (e) {
                        layer.msg('服务器链接超时!', { icon: 0, time: 1000 });
                    },
                    complete: function () {

                    }
                })
            })
        })
        function Show() {
            //初始化
            $.ajax({
                type: "get",
                url: ApiUrl + "api/InquiryRecord/Selectbyid",
                data: { P_ReportNumber: P_ReportNumber },
                success: function (data, status) {
                    if (status == "success") {
                        $(".listTableShow").empty();
                        $(data).each(function (i, item) {
                            $(".listTableShow").append("<dl>");
                            $(".listTableShow").append(" <dd>建议价格：" + item.T_Price + "万</dd>");
                            $(".listTableShow").append(" <dd>询价内容：" + item.T_Iname + "</dd>");
                            $(".listTableShow").append(" <dd>询价时间：" + new Date(item.T_Date).Format("yyyy-MM-dd hh:mm:ss") + "</dd>");
                            $(".listTableShow").append("<dl>");
                        });
                    }
                },
                error: function (e) {
                    layer.msg('服务器链接超时!', { icon: 2, time: 1000 });
                },
                complete: function () {

                }
            })

            ///判断状态去取消按钮
            $.ajax({
                type: "get",
                url: ApiUrl + "api/Personal/selectbyP_ReportNumberss",
                data: {
                    P_ReportNumber: P_ReportNumber
                },
                //async: false,
                //contentType: 'application/json',
                success: function (data, status) {
                    if (status == "success") {
                        if (data != null) {
                            if (data.T_State != 1) {
                                $("#jbSub").remove();
                            }
                        }
                    }
                },
                error: function (e) {
                    layer.msg('服务器链接超时!', { icon: 2, time: 1000 });
                },
                complete: function () {

                }
            })
        }
    </script>
</body>
</html>
